package com.tlgen.service;

import com.tlgen.mapper.DeanMapper;
import com.tlgen.model.Dean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author: tlgen
 * @Discription:
 */
@Service
public class DeanService {

    @Autowired
    DeanMapper deanMapper;

    public Integer deleteDeanByIds(Integer[] ids) {
        return deanMapper.deleteDeanByIds(ids);
    }

    public Integer deleteDeanById(Integer id) {
        return deanMapper.deleteByPrimaryKey(id);
    }

    public Integer updateDean(Dean dean) {
        return deanMapper.updateByPrimaryKeySelective(dean);
    }

    public Integer addDean(Dean dean) {
        dean.setCreateDate(new Date());
        dean.setEnabled(true);
        return deanMapper.insertSelective(dean);
    }

    public List<Dean> getAllDeans() {
        return deanMapper.getAllDeans();
    }
}
